﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MS.InformationManagement.DAL.DTOs;
using System.Data;
using MS.InformationManagement.Support.Constants;
using MS.InformationManagement.DAL.Support;
using Microsoft.SharePoint;
using System.Globalization;
using MS.InformationManagement.DAL.DocumentCenter;

namespace MS.InformationManagement.BLL.ShippingControByUser
{
    public class ShippingControByUser
    {


        public static IEnumerable<Devolucion> SearchRadicados()
        {
            using (var dc = new DCDocumentCenterDataContext(SPContext.Current.Web.Url))
            {
                return (from item in dc.Devoluciones
                        where item.UsuarioAsignado == SPContext.Current.Web.CurrentUser.LoginName 
                        && item.EnvíoActivo == true
                        select item);                
            }
        }

        public static IEnumerable<Devolucion> SearchRadicados(string IdRadicado)
        {
            using (var dc = new DCDocumentCenterDataContext(SPContext.Current.Web.Url))
            {
                return (from item in dc.Devoluciones
                        where item.UsuarioAsignado == SPContext.Current.Web.CurrentUser.LoginName 
                        &&  item.Id.Value.ToString().Contains(IdRadicado)
                        && item.EnvíoActivo == true
                        select item);
            }
        }
    }
}
